Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

c++11 compatibility #6

Merged
merged 1 commit into from
Jan 27, 2018
Merged

c++11 compatibility #6

merged 1 commit into from
Jan 27, 2018

Conversation

rokups
Copy link
Contributor

@rokups rokups commented Jan 26, 2018

Replaced c++17 std::filesystem usage with platform api calls in order to support compiling with older compilers.

@fungos
Copy link
Owner

fungos commented Jan 26, 2018

I think I should accept it. I was against it due to added overhead in maintenance but is does not look too much right now and fs does not add any value at all here right now.

But before accepting it I would like some minor (formatting nitpick) changes.

Thank you!

cr.h Outdated
static void cr_split_path(std::string path, std::string &parent_dir,
std::string &base_name, std::string &ext) {
#if _WIN32
std::replace(path.begin(), path.end(), '/', CR_SEPARATOR);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use another define for the character being replaced with the one in 376-380 and avoid this ifdef here, something like: CR_INVALID_SEPARATOR or CR_FROM_SEPARATOR.

cr.h Outdated
std::unique_ptr<wchar_t[]> wpath_big;
wchar_t* wpath = wpath_small;
if (wlen > _countof(wpath_small))
{
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tried to run clang-format? I'm not sure if I've let it misconfigured or if it does not support it, I can't remember.
But { should be in the same line, also, any block even one-liners as in L493 should go inside braces, there are some if and a while without braces. So if you can fix it I'll be glad! :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah i used clang-format, but did these changes after. Will fix it. Although clang-format does quite a lot of other changes that i found surprising arent already in the repository

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I need check my clang-config and travis config anyway.
Just to note, you've missed some ifs and while without braces elsewhere. :P

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean ones with one line bodies? clang-format isnt adding braces to these. Should i?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. I think this case is unsupported by clang-format. Thanks, I'll push his when I'll get at home.

@fungos fungos merged commit 5d206fe into fungos:master Jan 27, 2018
@fungos fungos mentioned this pull request Jan 27, 2018
@rokups rokups deleted the feature/cxx11-fs branch January 30, 2018 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants